﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace GameWP
{
    public enum State
        {
            Move, 
            Fight, 
            Dead,
            Shooting,       // State đac biet chi gianh cho cung thu
            Disappear,      // State de xac dinh huy character do khoi man choi
            Unknow,         // State mac dinh khi chua xac dinh duoc State cua character, thuong dung cho preState
        };  
    public abstract class Character : Sprite2D
    { 
    #region  Properties
        protected int _hp;
        public int Hp
        {
            get { return _hp; }
            set
            {
                _hp = value;
                if (_hp > _hpmax)
                    _hp = _hpmax;
            }
        }

        protected int _hpmax;
        public int Hpmax
        {
            get { return _hpmax; }
            set { _hpmax = value; }
        }

        protected int _damage;
        public int Damage
        {
            get { return _damage; }
            set { _damage = value; }
        }

        protected float _speed;
        public float Speed
        {
            get { return _speed; }
            set { _speed = value; }
        }
        protected float _speedmax;
        public float Speedmax
        {
            get { return _speedmax; }
            set { _speedmax = value; }
        }

        protected int _indexTexture;
        public int IndexTexture
        {
            get { return _indexTexture; }
            set { _indexTexture = value; }
        }

        protected List<Texture2D> _listTextures;
        public List<Texture2D> ListTextures
        {
            get { return _listTextures; }
            set { _listTextures = value; }
        }

        protected List<List<int>> _seqTexture;
        public List<List<int>> SeqTexture
        {
            get { return _seqTexture; }
            set { _seqTexture = value; }
        }

        protected State _state;
        public State State
        {
            get { return _state; }
            set { _state = value;}
        }

        protected State _preState;
        public State PreState
        {
            get { return _preState; }
            set { _preState = value; }
        }

        protected float _delay;
        public float Delay
        {
            get { return _delay; }
            set { _delay = value; }
        }

        protected float _scaleTexture;
        public float ScaleTexture
        {
            get { return _scaleTexture; }
            set { _scaleTexture = value; }
        }

        protected int _price;
        public int Price
        {
            get { return _price; }
            set { _price = value; }
        }

        protected float _normalDelay = 20.0f;
        public float NormalDelay
        {
            get { return _normalDelay; }
            set { _normalDelay = value; }
        }

        protected Color _colorTexture = Color.White;
        public Color ColorTexture
        {
            get { return _colorTexture; }
            set { _colorTexture = value; }
        }

        protected HpBar _hpBar;
        public HpBar HpBar
        {
            get { return _hpBar; }
            set { _hpBar = value; }
        }
        
    #endregion        

    #region Initiation
        public Character(List<Texture2D> listTextures,
            Vector2 posotion, 
            int hp, 
            int damage, 
            float speed,
            float delay,
            float scaleTexture,
            int price,
            List<List<int>> seqTexture): base(null, posotion)            
        {
            _listTextures = listTextures;
            _position = posotion;
            _hp = hp;
            _damage = damage;
            _speed = speed;
            _delay = delay;
            _seqTexture = seqTexture;
            _price = price;
            _scaleTexture = scaleTexture;
            _rectangle = new Rectangle
                ((int)_position.X, (int)_position.Y, _listTextures[0].Width, _listTextures[0].Height);
            _scaleRect = 5;
            _indexTexture = 0;
            _state = State.Move;
            _preState = State.Unknow;
        }
    #endregion

    #region UPdate & Draw
        public override void Update(GameTime gametime, Vector2 position)
        {
        }

        public override void Draw(SpriteBatch spritebatch, GameTime gametime)
        {          
        }

    #endregion
    }
}
